package com.slz3.business.module.configManagement.conSiteCity.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conSiteCity.domain.ConSiteCity;
import com.slz3.business.module.configManagement.conSiteCity.domain.ConSiteCityFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConSiteCityTransactionalServiceImpl implements ConSiteCityTransactionalService {

    @Override
    public ConSiteCity modify(ConSiteCity conSiteCityNew) {
        Repositorys.conSiteCity.test();
        Repositorys.conSiteCity.save(ConSiteCityFactory.initBaseFields());
        System.err.println(1/0);
        conSiteCityNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conSiteCity.saveAndFlush(conSiteCityNew);
    }

    @Override
    public List<ConSiteCity> batchModify(List<ConSiteCity> conSiteCityList) {
        return Repositorys.conSiteCity.saveAll(conSiteCityList);
    }
}
